#include <iostream>

using namespace std;

int pourMilk(int x, int y, int m) {
  int result = 0;
  
  for (int i = 0; i < 1001; ++i) {
    if (x * i > m) {
      break;
    }

    for (int j = 0; j < 1001; ++j) {
      int n = x * i + y * j;
      result = max(n, result);
    }
  }

  return result;
}

int main(int argc, char const *argv[])
{
  /* code */
  return 0;
}
